{eval include template($common_template_pluginid.':new/common/header');}
<div class="weui-cells_form">
	<iframe style="display:none" name="myiframe" id="myiframe"></iframe>
	<form id="postform" name="postform" action="plugin.php?id=aljgwc&act=editaddress" method="POST"  accept-charset="utf-8">
		<input type="hidden" value="{FORMHASH}" name="formhash">
		<input type="hidden" value="$address_id" name="address_id">
		<input type="hidden" value="$s_id" name="shop_id">
		<input type="hidden" value="$pluginid" name="pluginid">
		<input type="hidden" value="$goods_id" name="goods_id">
		<input type="hidden" value="$num_goods" name="num">
		<input type="hidden" value="$attrs" name="attrs">
		<input type="hidden" value="$attrsid" name="attrsid">
		<input type="hidden" name="region" id="region" value="{$region}">
		<input type="hidden" name="subregion" id="subregion" value="{$subregion}">
		<input type="hidden" name="region1" id="region1" value="{$region1}">
		<div class="weui-cell weui-cell_access">
			<div class="weui-cell__hd"><label class="weui-label">{lang aljgwc:Local_area}</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" type="text" id='city-picker' value="{$default}"  placeholder="{lang aljgwc:editaddress_touch_2}"/>
			</div>
			<div class="weui-cell__ft"></div>
		</div>
		<div class="weui-cells weui-cells_form" style="margin-top: 0px">
			<div class="weui-cell">
				<div class="weui-cell__bd">
					<textarea class="weui-textarea" name="addressDetail" id="addressDetail" placeholder="{lang aljgwc:Address_in_detail_tips}" rows="3">{$address['addressDetail']}</textarea>
				</div>
			</div>
		</div>

		<div class="weui-cell">
			<div class="weui-cell__hd"><label class="weui-label">{lang aljgwc:Name_of_consignee}</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" type="text" value="{$address['fullName']}" placeholder="{lang aljgwc:Name_of_consignee_tips}" id="J_Name" name="fullName">
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label class="weui-label">{lang aljgwc:phone_number}</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" type="tel" value="{$address['mobile']}"  data-pattern="^\d{6,20}$" data-inner_placeholder="d_p_input_inner_mobile" placeholder="{lang aljgwc:editaddress_touch_1}" id="J_Mobile"  name="mobile_p">
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label class="weui-label">{lang aljgwc:postcode}</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" type="tel" value="{$address['post']}" id="J_PostCode" name="post" pattern="[0-9]*" placeholder="{lang aljgwc:postcode_tips}">
			</div>
		</div>
		<div class="weui-cell weui-cell_switch">
			<div class="weui-cell__bd">{lang aljgwc:Default_receiving_address}</div>
			<div class="weui-cell__ft">
				<input class="weui-switch" type="checkbox" name="defaultAddress" {if $address['defaultAddress']}checked{/if} value="1">
			</div>
		</div>
		<div class="weui-btn-area">
			<button class="weui-btn weui-btn_primary" name="address" type="submit" value="Y" onclick="$.showLoading();">{lang aljbd:sj_dianping_12}</button>
		</div>
	</form>
</div>
<script>
    +function($){
        $.rawCitiesData = $cityjson;
    }($);
</script>
<script src="{$common_path}/static/weui/js/city-picker.min.js" charset="utf-8"></script>
<script>
    $("#city-picker").cityPicker({
        title: "{lang aljgwc:editaddress_touch_2}",
        onChange: function (picker, values, displayValues) {
            console.log(values);
            $('#region').val(values[0]);
            $('#subregion').val(values[1]);
            if(values[1] == values[2]){
                $('#region1').val('');
            }else{
                $('#region1').val(values[2]);
            }
        }
    });
    function checkPostReview(form) {
        if(jq('#region').val().trim()=='') {
            alert('{lang aljgwc:Area_must_choose}');
            return false;
        }
        if(jq('#addressDetail').val().trim()=='') {
            alert('{lang aljgwc:Details_must_be_filled_in}');
            return false;
        }
        if(jq('#J_Name').val().trim()=='') {
            alert('{lang aljgwc:Name_must_be_filled_in}');
            return false;
        }
        if(jq('#J_PhoneCode').val().trim()=='' && jq('#J_Mobile').val().trim()=='') {
            alert('{lang aljgwc:Mobile_phone_number_must_be_filled_in}');
            return false;
        }
        return true;
    }
</script>
{eval include template($common_template_pluginid.':new/common/footer');}